home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 1510 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: news.iag.net!news
  2. From: jatmon@iag.net (John R Buchan)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Keyboard input: C's equivalent to BASIC's Inkey$
  5. Date: 14 Jan 1996 20:35:13 GMT
  6. Organization: Internet Access Group, Orlando, Florida
  7. Message-ID: <4dbpe1$47c@news.iag.net>
  8. References: <Pine.SUN.3.91.960111212844.17033A@suntan>
  9. NNTP-Posting-Host: pm3-orl13.iag.net
  10. X-Newsreader: WinVN 0.99.7
  11.  
  12. In article <Pine.SUN.3.91.960111212844.17033A@suntan>, cdiaz@eng.usf.edu 
  13. says...
  14. ->
  15. ->Hi! Can someone tell me what the C equivalent of BASIC's Inkey$ command 
  16. ->is? In particular, I'm looking to translate the following BASIC code to 
  17. ->C. It's the old, "wait for a key- if there is  no key do something else 
  18. ->then wait for a key, etc".
  19. ->
  20. ->DO
  21. ->  DO WHILE k$ = ""  'As long as there is no key, keep waiting
  22. ->    k$=Inkey$
  23. ->    ' Additional statements to increment a counter, update and display a
  24. ->    ' clock with running seconds, etc, can go here.
  25. ->  LOOP
  26. ->  PRINT k$;         'Print the key that was just gotten
  27. ->  k$=""
  28. ->LOOP
  29.  
  30. There no ansi or truly portable equivalent.  The c.l.c faq (Frequently
  31. Asked Question) list mentions several system specific possiblilties.
  32. The list is available for anonymous for from ftfm.mit.edu 
  33. /pub/usebet/comp.lang.c.
  34.  
  35. -- 
  36. John R Buchan           -:|:-     Looking for that elusive FAQ?  ftp to:
  37. jatmon@mail.iag.net     -:|:-     rtfm.mit.edu /pub/usenet-by-group/....
  38.  
  39.